import axios from "@/api/api.js";
import { getToken, setToken, removeToken,getAccount, setAccount, removeAccount } from '../auth.js';
const user = {
    namespaced: true,
    state: {
        token:getToken(),
        account:getAccount(),
        wxinfo:{},
    },
    getters:{
        sType:(state)=>{
            var act = state.account;
            if(act)
            {
                return parseInt(act.sType);
            }else{
                return 2;
            }
        }
    },
    mutations: {
        setToken(state,token){
            state.token = token;
            setToken(token);
        },
        setAccount(state,account){
            state.account = account;
            setAccount(JSON.stringify(account));
        },
		setWxinfo(state,payload){
			state.wxinfo = payload;
		},
        clear(state){
            removeToken();
            removeAccount();
            state.token='';
            state.account='';
        }
    },
    actions: {

    }
}

export default user
